Skip to content

chore: update protocol - #2421

Open
juan518munoz wants to merge 7 commits into
nextfrom
jmunoz-update-protocol
Open

chore: update protocol#2421
juan518munoz wants to merge 7 commits into
nextfrom
jmunoz-update-protocol

Conversation

@juan518munoz

@juan518munoz juan518munoz commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

Note

This PR does not work for chains which base fee is not zero (e.g network monitor and benchark binaries are only able to operate with fee-less chains). Full fee implementation is left as a follow-up PR.

Changelog

[[entry]]
scope       = "network-monitor"
impact      = "changed"
description = "The network monitor and the benchmark binary only operate on chains whose base fee is zero. Full fee support is left as a follow-up."

@juan518munoz
juan518munoz marked this pull request as ready for review August 3, 2026 17:26
Comment thread CHANGELOG.md

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file shouldn't be changed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted in d860a71

Comment on lines +1193 to +1203
let has_allowed_notes = allowlist_entries(NetworkAccountNoteAllowlist::slot_name())
.is_some_and(|entries| entries.as_map().values().any(|value| *value != Word::empty()));
let allows_expiration_tx_script =
allowlist_entries(NetworkAccountTxScriptAllowlist::slot_name()).is_some_and(|entries| {
entries
.as_map()
.get(&StorageMapKey::new(ExpirationTransactionScript::script_root().as_word()))
.is_some_and(|value| *value != Word::empty())
});
let is_network_account =
account_id.is_public() && has_allowed_notes && allows_expiration_tx_script;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually wonder if we still need to do this song and dance at all - @SantiagoPittella I believe this was likely a remnant of the ntx builders old sync?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is intended to stop users submitting transactions against network accounts, it's not sync related. It looks like this because AccountId::is_network() went away with AccountStorageMode::Network in #2095, so networkness determination relies on account's storage rather than the ID.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this means once fee's are turned on our monitor will be dead unless we somehow get it gas?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's the case. It would need funding, either through a faucet or by being provisioned as a pre-funded account at genesis, though either way it would eventually run dry and need topping up.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this so much more complex?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The network monitor submits real transactions to prove the chain's write path is alive. Now that notes are priced by the receiving account's fee policy, the wallet's transaction has to read the counter account's fee schedule through an FPI call.

Previously the wallet's transaction touched nothing but itself, so the data store never had to serve foreign account inputs and any reference block would do (genesis included which was what we used). An FPI'd account must be proven against the reference block's account tree, and the counter doesn't exist at genesis, so the transaction now has to anchor on a certain block instead.

(As a note, even on a zero-fee chain the transaction still has to make the FPI call to obtain that zero. pay_fee invokes create_network_note_sponsorships unconditionally before computing anything)

Comment thread bin/network-monitor/src/counter.rs Outdated
Comment on lines +1214 to +1222
/// Draw a random [`Word`] from `rng`.
fn random_word(rng: &mut ChaCha20Rng) -> Word {
Word::new([
Felt::new_unchecked(rng.random()),
Felt::new_unchecked(rng.random()),
Felt::new_unchecked(rng.random()),
Felt::new_unchecked(rng.random()),
])
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still not have rand implemented for these 🤔

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have rng implemented for RandomCoin, switched to this type.

d860a71

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants